package com.zuoyongyu2;

import com.alibaba.fastjson.JSON;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author lxh
 * @create 2019-04-04 15:15
 * @desc
 **/


/**
 * 在xml中配置“scope="prototype"指的是原型prototype，每次都是一个新的对象。如果不配置spring默认就是单例模式
 *
 * 在bean 中配置@Scope("prototype")  此demo有错，不建议使用
 */
public class App {

    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("zuoyongyu2.xml");
//        CustomerService customerService = (CustomerService) ac.getBean("customerService");
//        customerService.setMessage("Message by custA");
//        System.out.println(JSON.toJSONString(customerService));
//
//        CustomerService customerService2 = (CustomerService) ac.getBean("customerService");
//        System.out.println(JSON.toJSONString(customerService2));

    }
}
